package com.wootion.cims.module.communityservice.controller;

import com.wootion.cims.module.communityservice.dto.PersonDto;
import com.wootion.cims.module.communityservice.model.Condition;
import com.wootion.cims.module.communityservice.model.PageQuery;
import com.wootion.cims.module.communityservice.service.DisabilityService;
import com.wootion.cims.module.systemsetting.dictionary.model.LogAnotion;
import com.wootion.cims.response.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @Author: LanQiang
 * @Date: 2022/12/26/16:19
 * @Description: 残疾人信息
 */
@RestController
@Api(value = "残疾人信息")
@RequiresAuthentication
@RequestMapping(path = {"/disability"})
public class DisabilityController {
    
    @Resource
    private DisabilityService disabilityService;

    /**
     * 残疾人信息列表查询
     * @param pageQuery
     * @return
     */
    @PostMapping(path = {"/list"})
    @ApiOperation(value = "残疾人信息-列表查询", httpMethod = "POST",notes = "")
    public ResponseResult list(@RequestBody PageQuery pageQuery){
        return disabilityService.list(pageQuery);
    }
    /**
     * 残疾人信息修改保 * @param personDto
     * @return
     */
    @PostMapping(path = {"/edit/save"})
    @ApiOperation(value = "残疾人信息-修改保存", httpMethod = "POST",notes = "{'id':'f4a803f073ae2648e40e2ada10af9df5','oldMsgDto':{'survivalSkills':'','livingStatus':''}}")
    public ResponseResult editSave(@RequestBody PersonDto personDto, HttpServletRequest request){
        return disabilityService.editSave(personDto,request);
    }

    /**
     * 残疾人信息列表导出
     * @param condition
     * @return
     */
    @LogAnotion(type = "导出",value = "1",incident = "残疾人信息",prefixContent = "")
    @PostMapping(path = {"/excel"})
    @ApiOperation(value = "残疾人信息-excel导出", httpMethod = "POST",notes = "{\"ids\":[\"002443e3023366e6d984284134c63525\",\"09dbd05b9356f3cafae3d3bd7ced4b61\"]}")
    public ResponseResult disabilityExcel(@RequestBody Condition condition){
        return disabilityService.disabilityExcel(condition);
    }

    /**
     * 根基id查询残疾人信息
     * @param id
     * @return
     */
    @GetMapping(path = {"/find"})
    @ApiOperation(value = "残疾人信息-详情",httpMethod = "GET",notes = "")
    public ResponseResult find(@RequestParam(value = "id")String id){
        return disabilityService.find(id);
    }
}
